<?php

namespace app\post\model;


use app\common\traits\ModelCurd;
use think\Model;

class Category extends Model
{
    use ModelCurd;
    protected $table = 'cp_portal_category';
    protected $json = ["more"];

    public function getMoreAttr($value,$data){
        if($value){
            return json_decode( json_encode( $value),true);
        }
    }


    public function article()
    {
        return $this->belongsToMany(Post::Class,'portal_category_post',"post_id","category_id");
    }

}